<?
		function drizzo_version_number() {
			global $drizzo_options;

			drizzo_db_connect();

			$version_check = @mysql_query("SELECT * FROM `$drizzo_options` WHERE `name`='drizzo_version_number'");
			if(!mysql_errno()) {
				while($row = @mysql_fetch_assoc($version_check)) {
					$version = $row['value'];
				}
				return $version;
			} else {
				return false;
			}
		}
		
		function drizzo_version_status() {
			global $drizzo_options;

			drizzo_db_connect();

			$version_check = @mysql_query("SELECT * FROM `$drizzo_options` WHERE `name`='version_type'");
			if(!mysql_errno()) {
				while($row = @mysql_fetch_assoc($version_check)) {
					$version = $row['value'];
				}
				return $version;
			} else {
				return false;
			}
		}

		function drizzo_get_page_id() {
			unset($pageid);
			$url_info = dirname($_SERVER['REQUEST_URI']);
			if($url_info == '/drizzo') {
				$url_info = basename($_SERVER['REQUEST_URI']);
				$pageid = substr($url_info, 0, strpos($url_info,'.'));
			} else {
				$pageid = substr($url_info,strpos($url_info,'/',1) + 1,strpos($url_info,'.') - (strpos($url_info,'/',1) + 1));
			}
			if(!$pageid) {
				$pageid = 'dashboard';
			}
			define("pageid", $pageid);
			return pageid;
		}

		function drizzo_get_page_type() {
			global $install_directory;
			$pageid = "";
			$req_uri = $_SERVER['REQUEST_URI'];
			$url = strip_tags($req_uri);
			$url_array = explode("/",$url);
			array_shift($url_array); //the first one is empty anyway
			$pagetype = $url_array[0];
			$pagetype = preg_replace('/.php/', '', $pagetype);
			$pagetype = explode("?", $pagetype);
			$pagetype = $pagetype[0];
			if(("/$pagetype/" == "/drizzo/") || ("/$pagetype/" == "/$install_directory/drizzo/")) { $pagetype = "admin"; }
			if(!$pagetype) {$pagetype = "page";}
			define("pagetype", $pagetype);
			return pagetype;
		}

		$config_uri = dirname(__FILE__) . "/config.php";
		if(!file_exists($config_uri)) {
			header("Location: http://" . $_SERVER['SERVER_NAME'] . "/drizzo/engine/install.php");
			die();
		}
		@require_once($config_uri);
		require_once('functions_backend.php');
		require_once('functions_cache.php');
		require_once('functions_comments.php');
		require_once('functions_db.php');
		require_once('functions_events.php');
		require_once('functions_frontend.php');
		require_once('functions_gallery.php');
		require_once('functions_install.php');
		require_once('functions_links.php');
		require_once('functions_login.php');
		require_once('functions_media.php');
		require_once('functions_options.php');
		require_once('functions_plugins.php');
		require_once('functions_post.php');
		require_once('functions_tags.php');
		require_once('functions_trashheap.php');
		require_once('functions_users.php');
		require_once('functions_warehouse.php');
		require_once('lastRSS.php');

if(drizzo_plugins_enabled()) {
	$plugins = drizzo_plugins_enabled();
	foreach($plugins as $plugin) {
		$plugin = root_dir . "/drizzo-addons/plugins/" . $plugin;
		@include_once($plugin);
	}
}
?>
